import 'dart:convert' show json;

class LoginBean {

  int AgentId;
  int CityId;
  int DepartmentId;
  int RoleId;
  int RoleType;
  int TopAgentId;
  String Account;
  String Name;
  String RoleName;
  String SecretKey;
  String Token;
  List<FunctionCodeBean> FunctionCode;

  LoginBean.fromParams({this.AgentId, this.CityId, this.DepartmentId, this.RoleId, this.RoleType, this.TopAgentId, this.Account, this.Name, this.RoleName, this.SecretKey, this.Token, this.FunctionCode});

  factory LoginBean(jsonStr) => jsonStr == null ? null : jsonStr is String ? new LoginBean.fromJson(json.decode(jsonStr)) : new LoginBean.fromJson(jsonStr);

  LoginBean.fromJson(jsonRes) {
    AgentId = jsonRes['AgentId'];
    CityId = jsonRes['CityId'];
    DepartmentId = jsonRes['DepartmentId'];
    RoleId = jsonRes['RoleId'];
    RoleType = jsonRes['RoleType'];
    TopAgentId = jsonRes['TopAgentId'];
    Account = jsonRes['Account'];
    Name = jsonRes['Name'];
    RoleName = jsonRes['RoleName'];
    SecretKey = jsonRes['SecretKey'];
    Token = jsonRes['Token'];
    FunctionCode = jsonRes['FunctionCode'] == null ? null : [];

    for (var FunctionCodeItem in FunctionCode == null ? [] : jsonRes['FunctionCode']){
      FunctionCode.add(FunctionCodeItem == null ? null : new FunctionCodeBean.fromJson(FunctionCodeItem));
    }
  }

  @override
  String toString() {
    return '{"AgentId": $AgentId,"CityId": $CityId,"DepartmentId": $DepartmentId,"RoleId": $RoleId,"RoleType": $RoleType,"TopAgentId": $TopAgentId,"Account": ${Account != null?'${json.encode(Account)}':'null'},"Name": ${Name != null?'${json.encode(Name)}':'null'},"RoleName": ${RoleName != null?'${json.encode(RoleName)}':'null'},"SecretKey": ${SecretKey != null?'${json.encode(SecretKey)}':'null'},"Token": ${Token != null?'${json.encode(Token)}':'null'},"FunctionCode": $FunctionCode}';
  }
}

class FunctionCodeBean {

  int AgentId;
  String FunctionCode;

  FunctionCodeBean.fromParams({this.AgentId, this.FunctionCode});

  FunctionCodeBean.fromJson(jsonRes) {
    AgentId = jsonRes['AgentId'];
    FunctionCode = jsonRes['FunctionCode'];
  }

  @override
  String toString() {
    return '{"AgentId": $AgentId,"FunctionCode": ${FunctionCode != null?'${json.encode(FunctionCode)}':'null'}}';
  }
}

class LoginOutBean{

}

